package com.sky.wsp.sql.scanner.config;

import lombok.Getter;
import org.springframework.boot.web.context.WebServerInitializedEvent;
import org.springframework.boot.web.server.WebServer;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;
 
/**
 * @className: ServerConfig
 * @author: wang
 * @date: 2021/12/7
 **/
@Getter
@Component
public class ServerConfig implements ApplicationListener<WebServerInitializedEvent> {

    @Override
    public void onApplicationEvent(WebServerInitializedEvent webServerInitializedEvent) {
        WebServer webServer = webServerInitializedEvent.getWebServer();
        Integer port = webServer.getPort();
        System.out.println("启动成功，访问地址：http://localhost:" + port);

    }
}